<template>
    <view class="index">
        <home v-if="indexNav === 0" />
        <my v-else />
        <tab-bar :bottom-menus="bottomMenus" />
    </view>
</template>

<script setup lang="ts">
import my from "./component/my.vue";
import home from "./component/home.vue";
import TabBar from "@/components/tabBar.vue";
import { computed, getCurrentInstance, onMounted } from "vue";
import { useAppStore } from "@/store/modules/app";

const { proxy } = getCurrentInstance(); //this
const appStore = useAppStore();

onMounted(() => {});

// 从 Pinia store 中获取 indexNav
const indexNav = computed(() => appStore.indexNav);

const bottomMenus = computed(() => [
    {
        path: "",
        menu_name: "首页",
        selectedIconPath: "/static/tabs/noun-home-selected.png",
        iconPath: "/static/tabs/noun-home.png"
    },
    {
        path: "",
        menu_name: "我的",
        selectedIconPath: "/static/tabs/noun-rank-selected.png",
        iconPath: "/static/tabs/noun-rank.png"
    }
]);
</script>

<style lang="scss" scoped></style>
